package com.asset.order.controller;

import com.asset.order.service.OrderService;
import jakarta.annotation.Resource;
import org.asset.entity.Order;
import org.asset.until.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @PostMapping("/add")
    public R addOrder(@RequestBody Order order){
        System.out.println("--------------------------------------order");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println(order);
        return orderService.addOrder(order);
    }
}
